﻿<%@ Page Language="C#" MasterPageFile="~/Template.master" AutoEventWireup="true" CodeFile="QuanLyKhachHang.aspx.cs" Inherits="Employee_QuanLyKhachHang" Title="Untitled Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<script src="../jquery-ui/ui/ui.core.js" type="text/javascript"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<script type="text/javascript">


function showTatCaKhachHang()
{
    var url = "../Controllers/xlQuanLyKhachHang.aspx?";
    url += "sid=" + Math.random();
    jQuery.get(url, function(data)
	{
	$("#quanlykhachhang").html(data);
	});
	
}
function showKhachHang(str)
{
    
    var url = "../Controllers/xlTimKiemKhachHang.aspx?" + "keyword=" + str ; 
    url += "&sid=" + Math.random();
    jQuery.get(url, function(data)
	{
	$("#quanlykhachhang").html(data);
	});
	
}

function showChiTietKhachHang(maKhachHang)
{
    var divChiTiet = document.getElementsByName("divChiTiet");
    for(i = 0 ; i < divChiTiet.length ; i++)
        divChiTiet[i].innerHTML = "";
    
    var url = "../Controllers/xlChiTietKhachHang.aspx?" + "maKhachHang=" + maKhachHang;
    url += "&sid=" + Math.random();
    jQuery.get(url, function(data)
	{
	$("#divShow" + maKhachHang).html(data);
	});
}

function cancelCapNhat()
{
    var divChiTiet = document.getElementsByName("divChiTiet");
    for(i = 0 ; i < divChiTiet.length ; i++)
        divChiTiet[i].innerHTML = "";
}
	   
$(document).ready( function()
{
    showTatCaKhachHang();
    $("#btnSearch").click( function ()
    {
        var keyword = $("#txtSearch").attr("value");
        if(keyword != "")
            showKhachHang(keyword);
        else
            alert("Bạn chưa nhập từ khóa");
    });
    $("#btnShow").click( function ()
    {
        showTatCaKhachHang();
    });
   
});
</script>
<div align="center" id="divSearch">
    <input type="text" id="txtSearch" class="textfield" />
    <input type="button" id="btnSearch" value="Tìm" />
    <input type="button" id="btnShow" value="Xem tất cả khách hàng" />
    
</div>
<br />
<div id="quanlykhachhang"></div>
</asp:Content>

